
#HLA EPITOPES FREQUENCY DATABASE
#Function: Insert data into [epitopes] table [EpitHLA] schema
#Created in: 29.01.2014
#Author: Louise Takeshita


use strict;
use EpiHash qw(epi_data);

#Process Epitope data into HashMap
my %epitopes = epi_data; # returns epitope hashmap

#Create output file
open(OUTPUT,">insert_epitopes.sql") || die "The file insert_epitopes.sql could not be opened.\n"; #open file and handle unexpected errors

#Processing
for my $ep ( sort { $epitopes{$a}{'pos'} <=> $epitopes{$b}{'pos'}} keys %epitopes )
	{
	my $epit_id = $epitopes{$ep}{'pos'};
	print OUTPUT "INSERT INTO EpitHLA.epitopes VALUES ($epit_id,'$ep');\n";
	}
print "Done!";